package main.java.indi.zyj.c150.dps;

import java.util.Scanner;

public class _06_ThreeStep {

    static int m = 0, n = 0;
    static Character[][] map = new Character[100][100];
    static int[][] dir = {
        {-2, -1}, {-2, 1}, {2, -1}, {2, 1},
        {1, 2}, {1, -2}, {-1, 2}, {-1, -2}
    };



    static void Dfs(int x, int y, int step){

        if (step > 3 || x<0 || x>=m || y<0 || y>=n){
            return;
        }
        map[x][y] = '#';

        for (int i = 0; i < 8; i++) {
            Dfs(x + dir[i][0], y + dir[i][1], step + 1);
        }

    }

    public static void main(String[] args) {

        int x, y;
        Scanner scan = new Scanner(System.in);

        System.out.println("请输入棋盘的大小：");
        m = scan.nextInt();
        n = scan.nextInt();
        System.out.println("请输入马起始位置：");
        x = scan.nextInt();
        y = scan.nextInt();

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                map[i][j] = '.';
            }
        }

        Dfs(x-1, y-1, 0);

        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(map[i][j]);
            }
            System.out.println();
        }

    }



}
